package com.mysql.view;

import com.mysql.Action.StudentsAction;

import java.sql.SQLException;
import java.util.Scanner;

/*
* 视图层
* */
public class StudentsView {
    public static void main(String[] args) throws SQLException {
        StudentsAction sa = new StudentsAction();
        Scanner sc = new Scanner(System.in);
        do{
            System.out.println("请选择操作:");
            System.out.println("1.添加学生信息");
            System.out.println("2.删除学生信息");
            System.out.println("3.修改学生信息");
            System.out.println("4.查看指定学生信息");
            System.out.println("5.查看所有学生信息");
            System.out.println("6.退出");

            switch (sc.next()){
                case "1":
                    sa.add();
                    break;
                case "2":
                    sa.del();
                    break;
                case "3":
                    sa.update();
                    break;
                case "4":
                    sa.query();
                    break;
                case "5":
                    sa.queryall();
                    break;
                case "6":
                    return;
            }
            System.out.println("请按任意键再回车继续!");
            sc.next();
        }while(true);
    }
}
